from time import sleep

from page_locators.job_transfer_manage_locator import JobTransferManageLocator as JML
from page_locators.career_management_locator import CareerManagementLocator as CML
from common.base_page import BasePage
from test_datas.career_manage_datas import *
from test_datas.pic_data import *

class JobTransferManagement(BasePage):

    def __init__(self, driver):
        super().__init__(driver)

    def job_transfer_manage_click(self, username, password):
        self.input(CML.username_loc, username, '用户名输入失败截图')
        self.input(CML.password_loc, password, '密码输入失败截图')
        code = self.get_code(CML.captcha_img, '验证码图片定位', 'src')
        self.input(CML.captcha, code, '验证码输入')
        self.click(CML.loginsbt, '登录按钮点击失败截图')
        sleep(1)
        self.switch_window()
        sleep(1)
        self.click(JML.teacher_manage, "教职工信息管理点击跳转")
        sleep(0.5)
        self.click(JML.job_transfer, "转岗管理菜单点击")

    def add_job_transfer(self):
        sleep(1)
        self.click(JML.job_transfer, "转岗管理菜单点击")
        sleep(1)
        self.click(JML.add_job_transfer, "添加转岗点击")
        
    def name_error1(self):
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "dsgregeg", "名称输入框定位输入")
        self.wait(JML.name_tips, 10, 1)

    def name_error2(self):
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, big_string, "名称输入框定位输入")
        self.wait(JML.name_tips, 10, 1)

    def name_error3(self):
        self.input(JML.job_transfer_time, "2022-11-21", "转岗时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.job_category, "转岗类别下拉框定位点击")
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.job_level, "岗位等级定位点击")
        self.click(JML.manage_secondary, "管理二级定位点击")
        self.click(JML.sure, "确定按钮定位点击")


    def name_error4(self):
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, ' ', "名称输入框定位输入")
        self.wait(JML.name_tips, 10, 1)

    def add_teacherinfo(self):
        self.click(CML.career_management, "入职管理定位点击")
        self.click(CML.add_teacher, "添加教师点击跳转")
        self.input(CML.name, '亚瑟', "名称输入框定位输入")
        self.click(CML.category_faculty, '教职工类别定位点击')
        self.click(CML.fulltime_teacher, "专任教师定位点击")
        self.input(CML.phone, "13000000012", "手机号定位输入")
        self.input(CML.idcard, id18_X, "身份证输入框定位输入")
        self.input(CML.emile, emile_phone, "邮箱输入框定位输入")
        self.input(CML.church, cheles19, "教籍输入框定位输入")
        self.click(CML.sure, "确定按钮点击定位")

    def delete_add_teacherinfo(self):
        self.click(CML.career_management, "入职管理定位点击")
        self.click(CML.del_ys, "列表第一个删除按钮定位点击")
        self.click(CML.continue_del, "继续删除按钮定位点击")
        self.click(CML.check_know, "我已知晓定位点击")
        self.click(CML.sure_dle, '确定删除按钮定位点击')

    def input_name(self):
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, '亚瑟', "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def input_phone(self):
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, '13000000012', "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def input_id(self):
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, id18_X, "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def input_emile(self):
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, emile_phone, "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def input_church(self):
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, cheles19, "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def job_transfer_time_none(self):
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")
        self.click(JML.job_category, "转岗类别下拉框定位点击")
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.job_level, "岗位等级定位点击")
        self.click(JML.manage_secondary, "管理二级定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def job_transfer_type_none(self):
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")
        self.input(JML.job_transfer_time, "2022-11-21", "转岗时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def job_transfer_level_none(self):
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        self.click(JML.list1, "名称列表第一个定位点击")
        self.input(JML.job_transfer_time, "2022-11-21", "转岗时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.job_category, "转岗类别下拉框定位点击")
        sleep(1)
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def must_be_entered(self):         # 必输必选项输入选择
        self.add_teacherinfo()
        self.add_job_transfer()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        self.click(JML.list1, "名称列表第一个定位点击")
        self.input(JML.job_transfer_time, "2022-11-21", "转岗时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.job_category, "转岗类别下拉框定位点击")
        sleep(1)
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.job_level, "岗位等级定位点击")
        self.click(JML.manage_secondary, "管理二级定位点击")

    def part_time_job_officetime_input(self):
        self.must_be_entered()
        self.input(JML.part_time_job_officetime, "2023-01-11", "兼任任职时间定位输入")
        self.click(JML.sure, "确定按钮定位点击")

    def part_time_job_type_click(self):
        self.must_be_entered()
        self.click(JML.part_time_job_type, "兼任岗位类别下拉框点击")
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def post_grades_default(self):
        self.add_job_transfer()
        self.click(JML.post_grades, "兼任岗位等级下拉框定位点击")

    def post_grades_success(self):
        self.must_be_entered()
        self.click(JML.part_time_job_type, "兼任岗位类别下拉框点击")
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.post_grades, "兼任岗位等级下拉框定位点击")
        self.click(JML.manage_secondary, "管理二级定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def post_grades_error(self):
        self.must_be_entered()
        self.click(JML.part_time_job_type, "兼任岗位类别下拉框点击")
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.post_grades, "兼任岗位等级下拉框定位点击")
        self.click(JML.manage_secondary, "管理二级定位点击")
        self.suspension_loc(JML.s1, JML.clear_box, "悬浮定位清除兼任岗位类别")
        self.click(JML.part_time_job_type, "兼任岗位类别下拉框点击")
        self.click(JML.teacher_job, "教师岗位定位点击")
        self.click(JML.sure, "确定按钮定位点击")
        
    def note_error1(self):
        self.add_job_transfer()
        self.input(JML.note, big_string, "备注定位输入")

    def note_error2(self):
        self.add_job_transfer()
        self.input(JML.note, cheles101, "备注定位输入")

    def note_success1(self):
        self.add_job_transfer()
        self.input(JML.note, cheles100, "备注定位输入")

    def note_success2(self):
        self.add_job_transfer()
        self.input(JML.note, cheles99, "备注定位输入")

    def accessory_input_pic(self):
        sleep(1)
        self.upload_file(JML.accessory, getFile_png, "附件定位上传")

    def accessory_input_twofile(self):
        self.accessory_input_pic()
        sleep(1)
        self.upload_file(JML.accessory, cover_pic, "附件定位上传")

    def accessory_input_txt(self):
        sleep(1)
        self.upload_file(JML.accessory, txt, "附件定位上传")

    def accessory_input_excel(self):
        sleep(1)
        self.upload_file(JML.accessory, excel, "附件定位上传")

    def accessory_input_zipfile(self):
        sleep(1)
        self.upload_file(JML.accessory, zip_file, "附件定位上传")

    def scene_job_transfer(self):
        self.must_be_entered()
        self.input(JML.part_time_job_officetime, "2023-01-11", "兼任任职时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.part_time_job_type, "兼任岗位类别下拉框点击")
        self.click(JML.manage_job, "管理岗位定位点击")
        self.click(JML.post_grades, "兼任岗位等级下拉框定位点击")
        self.click(JML.manage_secondary, "管理二级定位点击")
        self.input(JML.note, cheles99, "备注定位输入")
        self.upload_file(JML.accessory, getFile_png, "附件定位上传")
        self.click(JML.sure, "确定按钮定位点击")

    def salary_level_manage_click(self):
        self.click(JML.job_transfer, "转岗管理菜单点击")
        sleep(2)
        self.click(JML.salary_level_manage, "薪级管理菜单点击")

    def add_salary_click(self):
        sleep(1)
        self.salary_level_manage_click()
        sleep(1)
        self.click(JML.add_salary, "添加薪级点击")

    def salary_name_error1(self):
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "dsgregeg", "名称输入框定位输入")
        self.wait(JML.name_tips, 10, 1)

    def salary_name_error2(self):
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, big_string, "名称输入框定位输入")
        self.wait(JML.name_tips, 10, 1)

    def salary_name_error3(self):
        self.input(JML.change_time, "2022-11-21", "变更时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.salary_level, "薪级下拉框定位点击")
        self.click(JML.level_8, "薪级8定位点击")
        self.click(JML.sure, "确定按钮定位点击")


    def salary_name_error4(self):
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, ' ', "名称输入框定位输入")
        self.wait(JML.name_tips, 10, 1)

    def salary_input_name(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, '亚瑟', "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def salary_input_phone(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, '13000000012', "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def salary_input_id(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, id18_X, "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def salary_input_emile(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, emile_phone, "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def salary_input_church(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, cheles19, "名称输入框定位输入")
        sleep(1)
        self.click(JML.list1, "名称列表第一个定位点击")

    def salary_change_time_none(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        self.click(JML.list1, "名称列表第一个定位点击")
        self.click(JML.salary_level, "薪级下拉框定位点击")
        sleep(1)
        self.click(JML.level_8, "薪级8定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def salary_level_none(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        self.click(JML.list1, "名称列表第一个定位点击")
        self.input(JML.change_time, "2021-10-11", "变更时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.sure, "确定按钮定位点击")

    def salary_note_error1(self):
        self.add_salary_click()
        self.input(JML.note, big_string, "备注定位输入")

    def salary_note_error2(self):
        self.add_salary_click()
        self.input(JML.note, cheles101, "备注定位输入")

    def salary_note_success1(self):
        self.add_salary_click()
        self.input(JML.note, cheles100, "备注定位输入")

    def salary_note_success2(self):
        self.add_salary_click()
        self.input(JML.note, cheles99, "备注定位输入")

    def salary_accessory_input_pic(self):
        sleep(1)
        self.upload_file(JML.accessory, getFile_png, "附件定位上传")

    def salary_accessory_input_twofile(self):
        self.salary_accessory_input_pic()
        sleep(1)
        self.upload_file(JML.accessory, cover_pic, "附件定位上传")

    def salary_accessory_input_txt(self):
        sleep(1)
        self.upload_file(JML.accessory, txt, "附件定位上传")

    def salary_accessory_input_excel(self):
        sleep(1)
        self.upload_file(JML.accessory, excel, "附件定位上传")

    def salary_accessory_input_zipfile(self):
        sleep(1)
        self.upload_file(JML.accessory, zip_file, "附件定位上传")

    def salary_manage_scene(self):
        self.add_teacherinfo()
        self.add_salary_click()
        self.remove_attribute(JML.name, "名称输入框定位", "readonly")
        self.input(JML.name, "亚瑟", "名称输入框定位输入")
        self.click(JML.list1, "名称列表第一个定位点击")
        self.input(JML.change_time, "2021-10-11", "变更时间定位输入")
        self.click(JML.name, "名称输入框定位点击")
        self.click(JML.salary_level, "薪级下拉框定位点击")
        sleep(1)
        self.click(JML.level_8, "薪级8定位点击")
        self.input(JML.note, cheles99, "备注定位输入")
        self.upload_file(JML.accessory, getFile_png, "附件定位上传")
        self.click(JML.sure, "确定按钮定位点击")








